﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FizzBuzz.Service;

namespace FizzBuzz.ServiceImpl.Validation
{
    public class FizzBuzzInputValidator:IInputValidator
    {
        public IEnumerable<IValidationError> isValid(int low, int high)
        {
            var errors = new List<IValidationError>();
            if (low < 1)
            {
                errors.Add(new FizzBuzzValidationError() { Text = "Lower bound cannot be less than 1.", Input = low });
            }
            if (high > 1000)
            {
                errors.Add(new FizzBuzzValidationError() { Text = "Upper bound cannot be higher than 1000.", Input = high });
            }
            if (high < low)
            {
                errors.Add(new FizzBuzzValidationError() { Text = "Lower bound cannot be higher than upper bound.", Input = low });
            }

            return errors;
        }
    }
}
